﻿using System;
using WcfTest.ConsoleClient.TalkingService;

namespace WcfTest.ConsoleClient
{
	class Program
	{
		#region Constants

		private const int SEPARATOR_LENGTH = 10;
		private const string NAME = "John Daw";

		#endregion Constants

		#region Main

		static void Main()
		{
			var client = new TalkingServiceClient();

			SayTest(client);
			Separator();
			GreetSomeOneTest(client);
			Separator();

			Console.WriteLine("Press <ENTER> to terminate.");
			Console.ReadLine();
		}

		#endregion Main

		#region Helpers

		private static void SayTest(ITalkingService client)
		{
			var response = client.Say();
			Console.WriteLine("Service said: '{0}'", response);
		}

		private static void GreetSomeOneTest(ITalkingService client)
		{
			var nameDto = new NameDto {Name = NAME};
			var greetingDto = client.GreetSomeone(nameDto);

			Console.WriteLine("Greeting {0}: '{1}'", NAME, greetingDto.Greeting);
		}

		private static void Separator()
		{
			Console.WriteLine(new string('=', SEPARATOR_LENGTH));
		}

		#endregion Helpers
	}
}
